#include "InputMessage.h"
#include "BasicTypes.h"

#include "MsgSetDecodeFormat.h"
#include "MsgDecodeRequest.h"
#include "MsgSetFilter.h"
#include "MsgMatchRequest.h"
#include "MsgShutdown.h"
#include "MsgSetOption.h"
#include "MsgAddTableEntry.h"
#include "MsgDeleteTableEntry.h"

using namespace std;

pInputMessage IInputMessage::Create(MessageType type, const string & data)
{
	switch (type)
	{
	case MT_SET_DECODE_FORMAT:
		return pInputMessage(new MsgSetDecodeFormat(data));
		break;
	case MT_DECODE_REQUEST:
		return pInputMessage(new MsgDecodeRequest(data));
		break;
	case MT_SET_FILTER:
		return pInputMessage(new MsgSetFilter(data));
		break;
	case MT_MATCH_REQUEST:
		return pInputMessage(new MsgMatchRequest(data));
		break;
	case MT_SHUTDOWN:
		return pInputMessage(new MsgShutdown());
		break;
	case MT_SET_OPTION:
		return pInputMessage(new MsgSetOption(data));
		break;
    case MT_ADD_TABLE_ENTRY:
        return pInputMessage(new MsgAddTableEntry(data));
        break;
    case MT_DELETE_TABLE_ENTRY:
        return pInputMessage(new MsgDeleteTableEntry(data));
        break;
	}
	return pInputMessage();
}